package com.neuedu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.common.Constants;
import com.neuedu.pojo.Result;
import com.neuedu.pojo.TAccount;
import com.neuedu.pojo.TAdministrator;
import com.neuedu.mapper.TAdministratorMapper;
import com.neuedu.pojo.TElder;
import com.neuedu.service.ITAdministratorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhangsan
 * @since 2024-06-16
 */
@Service
public class TAdministratorServiceImpl extends ServiceImpl<TAdministratorMapper, TAdministrator> implements ITAdministratorService {
    @Autowired
    TAdministratorMapper administratorMapper;

    @Override
    public Result findByAdminno(String adminno) {
        LambdaQueryWrapper<TAdministrator> lqw = new LambdaQueryWrapper<>();
        lqw.eq(TAdministrator::getAdminNo, adminno);
        List<TAdministrator> administrators = administratorMapper.selectList(lqw);
        return Result.success(administrators, "查询成功");
    }

    @Override
    public Result modAdmin(TAdministrator administrator) {
        return Result.success(administratorMapper.updateById(administrator),"修改成功");
    }
}
